<!--
 * @Author: zlc
 * @Date: 2021-11-22 22:35:33
 * @LastEditTime: 2021-11-22 23:12:20
 * @LastEditors: zlc
 * @Description: 
 * @FilePath: \个人\备份托管在git\source-notes\源码记录\vue3\index.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let person = {
            name: "张三",
            age: 18
        }

         const p=new Proxy(person,{
                    //获取
                    get(target,propName){
                        console.log("读取了p身上的对象",propName);
                        return Reflect.get(target,propName) 
                    },
                    //修改。追加ai
                    set(target,propName,value){
                        console.log("修改了p身上的对象",propName);
                        Reflect.set(target,propName,value)
                        target[propName]=value
                    },
                    //删除
                    deleteProperty(target,propName){
                        console.log("删除了p身上的对象"+propName);
                        return Reflect.deleteProperty(target,propName);
                    }
                })
         
        let obj = {
            a: 1,
            b: 2
        }

    </script>
</body>

</html>